//
//  main.m
//  OCChater2
//
//  Created by 郭家正 on 2019/1/7.
//  Copyright © 2019 TM. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Car.h"
#import "Greeter.h"

int main(int argc, const char * argv[]) {
//    Car *car1 = [[Car alloc] init];
//    car1.name = @"宝马1系";
//    car1.color = @"深红色";
//    car1.isNewEnergy = NO;
//
//    Car *car2 = [[Car alloc]init];
//    car2.name = @"特斯拉T1";
//    car2.color = @"象牙白";
//
//    car2.isNewEnergy = YES;
//
//    [car1 driveCar];
//    [car1 backCar];
//    [car1 stopCar];
//
//    [car2 driveCar];
//    [car2 backCar];
//    [car2 stopCar];
    Greeter *greater1 = [[Greeter alloc]init];
    greater1.name = @"全家新店";
    greater1.location = @"上海宝山区";
    
    [greater1 sayHello];
    [greater1 sayHello:@"冬日的一把火"];
    
    [greater1 sayHello:@"老豆腐" type:@"钻石"];
    
    NSString *sss = @"ssssssdfdf";
    NSInteger length = [sss length];
    NSLog(@"sss的长度是%d",length);
    for (int i = 0; i < length ; i++) {
        NSLog(@"%c",[sss characterAtIndex:i]);
    }
    NSString *from5 = [sss substringFromIndex:5];
    NSLog(@"从第5个位置往后的字符串是:%@",from5);
    NSString *to5 = [sss substringToIndex:5];
    NSLog(@"从开始到第5个位置的字符串是:%@",to5);
    return 0;
}
